<html>
    <head>
        <?php require RCMS_Object_QuickConfig_QuickConfig::PATH_HEADER; ?>
		<title>{%Quote%} [<?php echo $this->quoteName; ?>]</title>
        <?php $this->headScript()->appendFile((false !== @file_get_contents(RCMS_Object_QuickConfig_QuickConfig::G_JQ_HOSTED_URL)) ? RCMS_Object_QuickConfig_QuickConfig::G_JQ_HOSTED_URL : $this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
		<?php $this->headLink()->prependStylesheet($this->websiteUrl . 'system/css/quotestyle.css','screen'); ?>
        <?php $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/quoteprint.css','print') ?>
        <?php echo $this->headLink(); ?>
	</head>
	<body>
		{$seotop}
		<div id="quotemain">
			<div id="quotemainwrap">
				<div id="tophead">
					<div id="companyinfo">
                        <?php if (is_file($this->sitePath.$this->shoppingConfigData['company_logo'])) : ?>
						<div id="company-logo">
							<a href="<?php echo $this->websiteUrl; ?>"><img src="<?php echo $this->websiteUrl.$this->shoppingConfigData['company_logo']; ?>" alt="<?php echo $this->shoppingConfigData['company'];?>" /></a>
						</div>
                        <?php endif; ?>
                        <div id="company-data">
							<p><?php echo $this->shoppingConfigData['company']; ?></p>
							<p><?php
								echo $this->shoppingConfigData['address'];
								if (!empty($this->shoppingConfigData['address']) && !empty($this->shoppingConfigData['address2'])) echo ', ';
								if (!empty($this->shoppingConfigData['address2'])) echo $this->shoppingConfigData['address2'];
							?></p>
							<p><?php
								if (!empty($this->shoppingConfigData['city'])) echo $this->shoppingConfigData['city'];
								if (!empty($this->shoppingConfigData['city']) && (!empty($this->shoppingConfigData['state']) or !empty($this->shoppingConfigData['zip']))) echo ', ';
								if (!empty($this->shoppingConfigData['state'])) echo $this->shoppingConfigData['state'];
								if (!empty($this->shoppingConfigData['state']) && !empty($this->shoppingConfigData['zip'])) echo ' ';
								if (!empty($this->shoppingConfigData['zip'])) echo $this->shoppingConfigData['zip'];
								?></p>
							<p><?php if (!empty($this->shoppingConfigData['country'])) echo RCMS_Object_QuickConfig_QuickConfig::$worldCountries[$this->shoppingConfigData['country']];?></p>
							<p><?php if (!empty($this->shoppingConfigData['phone'])) echo '{%Phone%}: '.$this->shoppingConfigData['phone'];?></p>
							<p><a href="mailto:<?php echo $this->shoppingConfigData['email']; ?>"><?php echo $this->shoppingConfigData['email']; ?></a></p>
                        </div>
                    </div>

                    <?php if (isset($this->shippingAddress)) : ?>
                    <div id="shippinginfo" class="address-block">
                        <p>{%Shipped to%}:</p>
                        <p><?php echo $this->shippingAddress['firstname'] . ' ' . $this->shippingAddress['lastname']; ?></p>
                        <p>
                        <?php if (trim($this->shippingAddress['address1'])!='') echo $this->shippingAddress['address1'];
                         if (trim($this->shippingAddress['address1'])!='' && trim($this->shippingAddress['address2'])!='') echo ', ';
                         if (trim($this->shippingAddress['address2'])!='') echo $this->shippingAddress['address2'] ; ?></p>
                        <p>
                        <?php if (trim($this->shippingAddress['city'])!='') echo $this->shippingAddress['city'];
                         if (trim($this->shippingAddress['city'])!='' && (trim($this->shippingAddress['state'])!='' or trim($this->shippingAddress['zip'])!='')) echo ', ';
                         if ($this->shippingAddress['state'] && trim($this->shippingAddress['state'])!='') echo $this->shippingAddress['state'];
                         if (trim($this->shippingAddress['state'])!='' && trim($this->shippingAddress['zip'])!='') echo ' ';
                         if (trim($this->shippingAddress['zip'])!='') echo $this->shippingAddress['zip'];
                         ?>
                        </p>
                        <p>
                        <?php if (trim($this->shippingAddress['country'])!='') echo RCMS_Object_QuickConfig_QuickConfig::$worldCountries[$this->shippingAddress['country']]; ?>
                        </p>
                        <p><?php if (trim($this->shippingAddress['phone'])!='') echo $this->shippingAddress['phone']; ?></p>
                        <p><a href="mailto:<?php echo $this->shippingAddress['email']; ?>"><?php echo $this->shippingAddress['email']; ?></a></p>
                    </div>
                    <?php endif; ?>
					
					<div id="billinginfo" class="address-block">
						<p>{%Billing info%}:</p>
                        <p><?php echo $this->userName; ?></p>
                        <p><?php if (trim($this->userCompany)!='') echo $this->userCompany; ?></p>
                        <p>
                        <?php if (trim($this->userAddress1)!='') echo $this->userAddress1;
                         if (trim($this->userAddress1)!='' && trim($this->userAddress2)!='') echo ', ';
                         if (trim($this->userAddress2)!='') echo $this->userAddress2 ; ?></p>
                        <p>
                        <?php if (trim($this->userCity)!='') echo $this->userCity;
                         if (trim($this->userCity)!='' && (trim($this->userState)!='' or trim($this->userZip)!='')) echo ', ';
                         if ($this->userState && trim($this->userState)!='') echo $this->userState;
                         if ($this->userState && trim($this->userZip)!='') echo ' ';
                         if (trim($this->userZip)!='') echo $this->userZip;
                         ?>
                        </p>
                        <p>
                        <?php if (trim($this->userCountry)!='') echo RCMS_Object_QuickConfig_QuickConfig::$worldCountries[$this->userCountry]; ?>
                        </p>
                        <p><?php if (trim($this->userPhone)!='') echo $this->userPhone; ?></p>
                        <p><a href="mailto:<?php echo $this->userEmail; ?>"><?php echo $this->userEmail; ?></a></p>
					</div>

					<?php if ($this->pdfAllowed): ?>
					<div class="quotetool" ><a href="<?php echo $this->websiteUrl; ?>sys/backend_quote/pdf/id/<?php echo $this->quoteId; ?>/" target="_blank" style="color:#5C5C5C;"><img alt="PDF" src="<?php echo $this->websiteUrl?>system/images/file_pdf.png" />{%Save as PDF%}</a></div>
					<?php endif; ?>
					<div class="quotetool" ><a href="javascript:window.print();" title="{%Print Quote%}"><img alt="&bullet;" src="<?php echo $this->websiteUrl?>system/images/print.png" />{%Print Quote%}</a></div>
				</div>
                <div id="quotebody" style="clear:both;">
					<div id="quotetitle">
						<h1>{%Quote%} # <?php echo $this->quoteId; ?></h1>
						<h3><?php echo '{%Created on%}: ' . $this->quoteDate;?></h3>
						<h3><?php echo '{%Expires%}: ' . $this->validUntil;?></h3>
					</div>
					
					
				<?php if(!empty($this->cartData)): ?>
					<table cellspacing="0" cellpadding="0" width="100%" border="1" bordercolor="#cccccc" style="border: 1px solid #cccccc; border-collapse: collapse">
						<thead>
							<tr>
								<th class="photo">{%Photo%}</th>
								<th class="name">{%Product%}</th>
								<th class="note">{%Note%}</th>
								<th class="qty">{%Qty%}</th>
								<th class="price">{%Price%} (<span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span>)</th>
								<th class="fullprice">{%Total price%} (<span class="currency""><?php echo $this->shoppingConfigData['currency']; ?></span>)</th>
							</tr>
						</thead>
					<?php foreach ($this->cartData as $id => $cartItem): ?>
						<?php if ($this->shoppingConfigData['show-price-ati'] == '1'): ?>
						<?php $price = $cartItem['price']!=0 ? ( $cartItem['price']+ (isset($this->taxes[$cartItem['id']])?$this->taxes[$cartItem['id']]:0) )  : '{%FREE%}' ;?>
						<?php else: ?>
						<?php $price = $cartItem['price']!=0 ? $cartItem['price'] : '{%FREE%}' ;?>
						<?php endif; ?>
						<tr class="usercart-item-product">
							<td class="photo"><img src="<?php echo $this->websiteUrl . $cartItem['photo']; ?>" width="50" height="50" alt="<?php echo $cartItem['name']; ?>"/></td>
							<td class="name"><?php echo $cartItem['name']; ?></td>
							<td class="note"><?php echo $cartItem['note']; ?></td>
							<td class="qty"><?php echo $cartItem['count']; ?></td>
							<td class="price"><?php echo $price; ?><?php echo (is_numeric($price)) ? '<span class="currency">'.$this->shoppingConfigData['currency'].'</span>' : '' ;?></td>
							<td class="fullprice"><?php echo (is_numeric($price)?($price*$cartItem['count']).'<span class="currency">'.$this->shoppingConfigData['currency'].'</span>':'{%FREE%}');?></td>
						</tr>
					<?php endforeach; ?>

					<?php if ($this->shoppingConfigData['show-price-ati'] == '1'): ?>
						<tr>
							<td class="lbl" colspan="5">{%Total inc. taxes%}:</td>
							<td class="fullprice"><?php echo number_format($this->totalPrice+$this->totalTax,2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<tr>
						<?php if (!empty($this->shipping)) : ?>
							<td class="lbl" colspan="5">{%Shipping%}:</td>
							<td class="fullprice"><?php echo $this->shipping != '0' ? number_format($this->shipping,2,'.','') : '{%FREE%}'; ?><span class="currency"><?php echo  $this->shipping != '0' ? $this->shoppingConfigData['currency'] : ''; ?></span></td>
						<?php endif; ?>
						</tr>
						<?php if (isset($this->discount) && $this->discount > 0) :?>
						<tr>
							<td class="lbl" colspan="5">{%Discount%}:</td>
							<td class="fullprice"><?php echo number_format($this->discount,2,'.',''); ?> <span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<?php endif;?>
						<tr>
							<td class="lbl" colspan="5">{%Total%}:</td>
							<td class="fullprice" id="grand-total"><?php echo number_format(($this->totalPrice+$this->totalTax+$this->shipping-$this->discount),2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<tr>
							<td class="lbl" colspan="5">{%Inc. Tax%}:</td>
							<td class="fullprice"><?php echo number_format($this->totalTax-$this->taxes['discount'],2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<tr>
							<td class="lbl" colspan="5">{%Total w/o Tax%}:</td>
							<td class="fullprice"><?php echo number_format(($this->totalPrice-$this->discount+$this->shipping+$this->taxes['discount']),2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
					<?php else: ?>
						<tr>
							<td class="lbl" colspan="5">{%Sub-total%}:</td>
							<td class="fullprice"><?php echo number_format($this->totalPrice,2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<tr>
							<td class="lbl" colspan="5">{%Tax%}:</td>
							<td class="fullprice"><?php echo number_format($this->totalTax,2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<?php if (!empty($this->shipping)) : ?>
						<tr>
							<td class="lbl" colspan="5">{%Shipping%}:</td>
							<td class="fullprice"><?php echo $this->shipping != '0' ? number_format($this->shipping,2,'.','') : '{%FREE%}'; ?><span class="currency"><?php echo $this->shipping != '0' ? $this->shoppingConfigData['currency'] : ''; ?></span></td>
						</tr>
						<?php endif; ?>
						<?php if ($this->discount) :?>
						<tr>
							<td class="lbl" colspan="5">{%Discount%}:</td>
							<td class="fullprice"><?php echo number_format($this->discount,2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
						<?php endif;?>
						<tr>
							<td class="lbl" colspan="5">{%Grand Total%}:</td>
							<td class="fullprice" id="grand-total"><?php echo number_format((($this->totalPrice-$this->discount)+$this->totalTax+$this->shipping),2,'.',''); ?><span class="currency"><?php echo $this->shoppingConfigData['currency']; ?></span></td>
						</tr>
					<?php endif; ?>

					</table>
				<?php endif; ?>
					
				</div>
				<div id="quotefooter">
					<?php if (isset ($this->quoteDisclaimer) && !empty ($this->quoteDisclaimer) ) :?>
						<p id="quote-disclaimer"><?php echo $this->quoteDisclaimer;?></p>
					<?php endif; ?>

					<?php if (isset($this->shoppingConfigData['legal-info']) && !empty ($this->shoppingConfigData['legal-info'])): ?>
						<p id="legal-info" style="margin-top: 25px;"><?php echo $this->shoppingConfigData['legal-info']; ?></p>
					<?php endif; ?>
				</div>
			</div>
		</div>
		{$seobottom}
	</body>
</html>